﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using Quartz.Core;
using ZilLion.TaskManager.Core;
using ZilLion.TaskManager.Core.Infrastructure;

namespace ZilLion.Core.TaskManager.Workstation.Data
{
    public class LogLevelConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                var loglevel = (Loglevel)value;
                switch (loglevel)
                {
                    case Loglevel.Info:
                        return Brushes.DarkGray;
                    case Loglevel.Warn:
                        return Brushes.Orange;
                    case Loglevel.Success:
                        return Brushes.Green;
                    case Loglevel.Error:
                        return Brushes.Red;
                    case Loglevel.Trace:
                        return Brushes.Cyan;
                    default:
                        return Brushes.DarkGray;
                }
            }
            return Brushes.DarkGray;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
    
}